package com.caocaog.market.front;

import com.caocaog.market.annotation.IgnoreAuth;
import com.caocaog.market.entity.AppVersion;
import com.caocaog.market.service.AppVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.GenericController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(value = "appVersion", tags = "App版本控制管理移动端API")
@RequestMapping("/api/appVersion")
public class AppVersionFrontController extends GenericController<AppVersion, AppVersionService> {

    @IgnoreAuth
    @ApiOperation(value = "获取app最新版本数据", notes =
            "参数含义：\n\ntype 版本类型  1:客户端iOS 2：客户端Android 3：骑士端iOS 4：骑士端Android 5：商户端iOS 6：商户端Android\n\n" +
                    "siteId 分站id，可以为空\n\nuserId 用户id\n\n返回值含义：\n\nisForcedUpdate 是否强制更新 0：否 1：是")
    @GetMapping("newAppInfo")
    public Result<?> getAppVersion(@RequestParam("type") Integer type,
                                   @RequestParam(value = "siteId", required = false) String siteId,
                                   @RequestParam(value = "userId", required = false) String userId) {
        return Result.OK(super.service.getNewAppVersion(type, siteId, userId));
    }

}
